<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>会员列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/statics/js/jquery-3.6.0.js"></script>
</head>
<body>
<jsp:include   page="menu.jsp" flush="true"/>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>新增会员</small>
                </h1>
            </div>
        </div>
    </div>
    <div class="col-md-9 column">
        <form class="form1" action="${pageContext.request.contextPath}/member/addMember" method="post">
            <div class="row">
                <div class="col-md-2 column" >
                    会员名字：
                </div>
                <div class="col-md-4 column" >
                    <input type="text" name="memberName" id="memberName" class="form-control"/>
                </div>
                <div class="col-md-3 column">
                    <span id="memberName1" style="display:none;color:red">请输入会员名</span>
                </div>
            </div>
            <div style="margin:10px"></div>
            <div class="row">
                <div class="col-md-2 column" >
                    身份证号：
                </div>
                <div class="col-md-4 column" >
                    <input type="text" name="memberNo" id="memberNo" class="form-control">
                </div>
                <div class="col-md-3 column">
                    <span id="memberNo1" style="display:none;color:red">请输入身份证号</span>
                </div>
            </div>
            <div style="margin:10px"></div>
            <div class="row">
                <div class="col-md-2 column" >
                    性别：
                </div>
                <div class="col-md-4 column" >
                    <input type="text" name="memberGender" id="memberGender"  class="form-control">
                </div>
                <div class="col-md-3 column">
                    <span id="memberGender1" style="display:none;color:red">请输入性别</span>
                </div>
            </div>
            <div style="margin:10px"></div>
            <div class="row">
                <div class="col-md-2 column" >
                    密码：
                </div>
                <div class="col-md-4 column" >
                    <input type="text" name="memberPwd" id="memberPwd"  class="form-control">
                </div>
                <div class="col-md-3 column">
                    <span id="memberPwd1" style="display:none;color:red">请输入密码</span>
                </div>
            </div>
            <div style="margin:10px"></div>
            <div class="row">
                <div class="col-md-2 column" >
                    手机号码：
                </div>
                <div class="col-md-4 column" >
                    <input type="text" name="memberMobile" id="memberMobile"  class="form-control">
                </div>
                <div class="col-md-3 column">
                    <span id="memberMobile1" style="display:none;color:red">请输入手机号码</span>
                </div>
            </div>
            <div style="margin:10px"></div>
            <div class="row">
                <div class="col-md-2 column" >
                    网费:
                </div>
                <div class="col-md-4 column" >
                    <input type="text" name="memberCost"  id="memberCost"  class="form-control">
                </div>
                <div class="col-md-3 column">
                    <span id="memberCost1" style="display:none;color:red">请输入网费</span>
                </div>
            </div>
            </br>
            <input type="button" onclick="checkForm()" value="新增" class="btn btn-primary">
        </form>
    </div>

</div>

<script type="text/javascript">
    var flag = true;var flag1 = true;var flag2 = true;var flag3 = true;
    var flag4 = true;var flag5 = true;
    function checkForm(){
        if($("#memberName").val() == ""){
            $("#memberName1").show();
            flag = false;
        }else{
            $("#memberName1").hide();
            flag = true;
        }
        if($("#memberNo").val() == ""){
            $("#memberNo1").show();
            flag1 = false;
        }else{
            $("#memberNo1").hide();
            flag1 = true;
        }

        if($("#memberGender").val() == ""){
            $("#memberGender1").show();
            flag2 = false;
        }else{
            $("#memberGender1").hide();
            flag2 = true;
        }

        if($("#memberPwd").val() == ""){
            $("#memberPwd1").show();
            flag3 = false;
        }else{
            $("#memberPwd1").hide();
            flag3 = true;
        }

        if($("#memberMobile").val() == ""){
            $("#memberMobile1").show();
            flag4 = false;
        }else{
            $("#memberMobile1").hide();
            flag4 = true;
        }


        if($("#memberCost").val() == ""){
            $("#memberCost1").show();
            flag5 = false;
        }else{
            $("#memberCost1").hide();
            flag5 = true;
        }
        if(flag && flag1 && flag2 && flag3 && flag4 && flag5){
            $(".form1").submit();
            return true;
        }else{
            return false;
        }
        return flag;
    }
</script>

</body>
</html>